package cn.com.cennavi.java;

import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

public class T {
	/**
	 * 
	 * @Description
	 * @author buf
	 */
	public static void writeMap2Redis(String key, Map<String, String> value) {

		Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
		jedisClusterNodes.add(new HostAndPort("172.20.10.141", 9001));
		JedisCluster jedis = new JedisCluster(jedisClusterNodes);
		for(Map.Entry<String, String>e:value.entrySet()){
			System.out.println("niuxinzan:writeMap2Redis : "+e.getKey()+","+e.getValue());
		}
		jedis.hmset(key, value);
		try {
			jedis.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
